/*
 * DominionEndIntegration.c
 *
 *  Created on: Mar 19, 2014
 *      Author: Laurye_OSU
 */


/*
 * DominionBuyIntegration.c
 *
 *  Created on: Mar 19, 2014
 *      Author: Laurye_OSU
 */


#include "dominion.h"
#include "dominion_helpers.h"
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <math.h>
#include "rngs.h"
#include "interface.h"


int numerrors=0;

int randInt(int low, int high)
{
	int temp = low + rand() % (high -low +1);
	return temp;

}






void playGame(int seed){

	int n;
	int i;
	int numPlayers;
	int player;
	int totalPlayers[MAX_PLAYERS];
	int success;
	int k[10];
	int score;

	//set up how many random games to play
	for (n = 0; n < 100; n++) {

	newGame();
	struct gameState G;
	numPlayers = floor(Random() * MAX_PLAYERS); //make number of players random
	  if (numPlayers < 2){ 	numPlayers = 2;  }
	  else if (numPlayers > 4){	numPlayers= 4;  }

	  //generate random kingdom cards
	  selectKingdomCards(rand(),k);


	//Initialize Game
	success = initializeGame(numPlayers, k, seed, &G);

	if (success != 0) {
		printf("Initializing Game Error");
		numerrors++;
		exit(0);
	}

	/*Give each player a turn*/
    	for(player = 0;player < numPlayers;player++){



	//get winners
		getWinners(totalPlayers, &G);
		for (i = 0; i < G.numPlayers; i++){
			score = scoreFor(i, &G);
		}

    }


	} // for loop for how many games

}


int main (int argc, char** argv)
{


	int seed;


	seed = rand();
	SelectStream(1);
	PutSeed(seed);

	playGame(seed);
	printf("All end game tests ran successfully\n");
	printf("Number of errors found was %d\n", numerrors);


	return 0;
}





